package com.key.win.business.chat.vo;

import com.key.win.base.auth.AuthenticationUtil;
import com.key.win.base.auth.detail.Authentication;
import com.key.win.business.chat.model.ImFriend;
import com.key.win.business.chat.model.ImGroupUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Map;

@ApiModel("好友VO")
@Data
public class ImGroupUserFullVo extends ImGroupUser {
    @ApiModelProperty("用户签名")
    private String sign;
    @ApiModelProperty("头像")
    private String avatar;
    @ApiModelProperty("好友分组Name")
    private String groupName;
    @ApiModelProperty("phone")
    private String phone;
    @ApiModelProperty("email")
    private String email;

    @ApiModelProperty("在否在线：true-在线，false-下线")
    public boolean getOnline() {
        Map<String, Authentication> onLineUserToMap = AuthenticationUtil.getOnLineUserToMap();
        if (onLineUserToMap.get(this.getUserId()) != null) {
            return true;
        }
        return false;
    }
}
